import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import Leancloud from './Leancloud'
Vue.prototype.$Leancloud = Leancloud
import { getToken, setToken } from '@/utils/auth'
Vue.prototype.$getToken = getToken
Vue.prototype.$setToken = setToken

// 应用 ID：021bbc7e
// AppSerect ：021bbc7ee20b71134d53e20206bd6feb
import sign from './js/sign'
Vue.prototype.$xfSign = sign
// 放大缩小
import vdr from 'vue-draggable-resizable-gorkys'
// 导入默认样式
import 'vue-draggable-resizable-gorkys/dist/VueDraggableResizable.css'
Vue.component('vue-draggable-resizable', vdr)
// 放大缩小

import Api from './api'

import '@/icons' // icon
import '@/permission' // permission control

import './assets/app.css'
import './assets/font/iconfont.css'


/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
if (process.env.NODE_ENV === 'production') {
  const { mockXHR } = require('../mock')
  mockXHR()
}

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  Leancloud,
  render: h => h(App)
})

setTimeout(() => {
  console.log(' 用户信息 》》》》》》》》》》 ')
  Leancloud.dataRequest.postGet({
    method:'POST',
    url:'https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal',
    data: {
      "app_id": "cli_a225774de838500b",
      "app_secret": "CtpnHHHo9NXBYaNhxiTzbeMBVXBesl1L"
    }
  }).then(res=>{
    // console.log('用户信息',res)
    store.commit('user/SET_tenant_access_token',res.tenant_access_token)
    // console.log('tenant_access_token',store.getters.tenant_access_token)
  })
}, 3000);
